package com.briup.day11;

/**
 * @author 谭梦寻
 * @version 1.1
 * 外部类
 */
public class OuterClass {
    private int id = 1;

    public void out() {
//        创建内部类之后才能访问它的属性和方法
        MemberInnerClass memberInnerClass = new MemberInnerClass();
        System.out.println(memberInnerClass.name);
        System.out.println(memberInnerClass.id);
    }


    //    定义成员内部类
    class MemberInnerClass {
        public String name;
        private int id = 0;

        //    不能定义静态方法和静态属性
        public void inner() {

        }
        public void method(){
            System.out.println("内部"+this.id);//内部id
            System.out.println("外部"+OuterClass.this.id);//外部id
        }
    }
    static class StaticClass {
        public int num;
        public void sing() {
            System.out.println("我要唱歌！");
        }
        public static void runSing() {
            System.out.println("边跑边唱！");
        }
    }
}
